<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/ztree/css/zTreeStyle/zTreeStyle.css"
      type="text/css">
<div class="pageContent">
	<form method="post" id="form" action="${pageContext.request.contextPath}${requestScope.record ==null ?'/system/merchantEmployees/insert' :'/system/merchantEmployees/update' }" class="pageForm required-validate">
		<div class="pageFormContent" layoutH="56">
			<!-- 关闭窗口 -->
			<input type="hidden" name="callbackType" value="closeCurrent" />
			<!-- 隐藏表单 -->
			<c:if test="${requestScope.record !=null}">
				<input type="hidden" name="employeeId" value="${requestScope.record.employeeId}" />
			</c:if>
			
			
			
			<p>
				<label>登陆名字</label> <input name="accountNum" class="required" maxlength="45" <c:if test="${requestScope.record != null}">readonly="readonly"</c:if> type="text" value="${requestScope.record.accountNum}" />
			</p>
			<p>
				<label>真实名字</label> <input name="employeeName" class="required" maxlength="45" type="text" value="${requestScope.record.employeeName}" />
			</p>
			<p>
				<label>性别</label> <input type="radio" name="employeeSex" value="1" checked="checked" ${requestScope.record.employeeSex==1 ? 'checked="checked"' :'' } />男 <input type="radio" name="employeeSex" value="2" ${requestScope.record.employeeSex==2 ? 'checked="checked"' :'' } />女
			</p>
			<p>
				<label>电话</label> <input type="text" name="employeePhone" class="required phone" maxlength="11" alt="" value="${requestScope.record.employeePhone}" />

			</p>
			<p>
				<label>生日</label> <input type="text" name="employeeBirthday" class="required date" readonly="true" value="<fmt:formatDate value="${record.employeeBirthday}" pattern="yyyy-MM-dd" />" /><a class="inputDateButton" href="javascript:;">选择</a>

			</p>



			<p>
				<label>身份证号</label> <input type="text" name="idcd" class="required" maxlength="18" value="${record.idcd}" />

			</p>
			<p>
				<label>门禁号</label> <input type="text" name="asct" class="required" maxlength="50" value="${record.asct}" />

			</p>
			<p>
				<label>户口地址</label> <input type="text" name="rdpa" class="required" maxlength="100" value="${record.rdpa}" />

			</p>
			<p>
				<label>现住地址</label> <input type="text" name="pspa" class="required" maxlength="100" value="${record.pspa}" />

			</p>





			<p>
				<label>部门</label> <select name="dmid" class="combox required">
					<option value="">请选择</option>
					<c:forEach items="${requestScope.departments}" var="item">
						<option value="${item.id }" ${item.id == requestScope.record.dmid?'selected':'' }>${item.name }</option>
					</c:forEach>
				</select>

			</p>
			<p>
				<label>员工状态</label> <select name="employeeState" class="combox required">
					<option value="0" ${requestScope.record.employeeState==0?'selected':''}>正常</option>
					<option value="1" ${requestScope.record.employeeState==1?'selected':''}>停用</option>
				</select>
			</p>
			<%-- <p>
				<label></label> <input name="employeePortrait" class="required" maxlength="45" type="text" value="${requestScope.record.employeePortrait}" />
			</p> --%>
			<div id="parameter" class="nowrap">
				<!-- 没数据是显示 -->
					<div class="unit">
						<label>岗位</label>
						<ul id="tpPermissionTree" class="ztree" style="margin-left: 125px;"></ul>
					</div>
			</div>
			
			
			
			
		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/ztree/js/jquery.ztree.core.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/ztree/js/jquery.ztree.excheck.js"></script>
<script type="text/javascript">
    var setting = {
        data: {
            simpleData: {
                enable: true
            }
        }, check: {
            enable: true,
            chkboxType: {
                "Y": "",
                "N": ""
            }
        }
    };

    var zNodes = ${requestScope.ztreeBeans};

    $(document).ready(function () {
        //ztree初始化  ztree 设置参数   ztree 内容
        $.fn.zTree.init($("#tpPermissionTree", $.pdialog.getCurrent()), setting, zNodes);
    });

    //监听form表单提交事件并且重写
    $("#form", $.pdialog.getCurrent()).submit(function () {
        //获取ztree 的js对象
        var treeObj = $.fn.zTree.getZTreeObj("tpPermissionTree", $.pdialog.getCurrent());
        //拿到ztree选中的节点
        var nodes = treeObj.getCheckedNodes(true);

        for (var i = 0; i < nodes.length; i++) {
            var node = nodes[i];
            //动态拼接到form表单里面
            $("#form", $.pdialog.getCurrent()).append("<input type='hidden' name='rid' value='" + node.id + "' />");
        }
        return validateCallback(this, dialogAjaxDone);
        //return false;
    })
</script>